import axios from './base'
import { useLocalStorage } from '@/use/useLocalStorage'
const { value: userInfo } = useLocalStorage('userInfo', '')
// 获取首页banner（轮播图）列表
export const fetchBannerList = () => {
  return axios.get('/api/home/banner')
}
// 获取游戏列表
export const fetchGameList = () => {
  return axios.get('/api/game/list')
}
// 获取首页"精品游戏"列表
export const fetchRecommendList = () => {
  return axios.get('/api/home/recommend_game')
}
// 获取首页"新游推荐"列表
export const fetchNewList = () => {
  return axios.get('/api/home/new_game')
}
// 获取首页"热门游戏"列表
export const fetchHotList = () => {
  return axios.get('/api/home/hot_game')
}
// 获取获取游戏详情
export const fetchGameInfo = (obj) => {
  return axios.post('/api/game/info', obj)
}
// 获取充值的商品列表
export const fetchGameProduct = (obj) => {
  return axios.post('/api/user/product/list', { header: 'none' })
}
// 创建订单
export const fetchCreatePayermaxOrder = (obj) => {
  return axios.post('https://pay-test-api.hayyachat.com/v1/charge/createPayermaxOrder', {
    ...obj,
    header: 'none',
  })
}
// 获取用户信息
export const fetUserInfo = (obj) => {
  return axios.post('/api/user/info', obj, {
    headers: {
      'user-id': userInfo.value.user_id,
      // Authorization: 'Bearer YOUR_ACCESS_TOKEN',
    },
  })
}
